package com.jzo2o.foundations.controller.consumer;

import com.jzo2o.foundations.model.domain.ServeType;
import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
import com.jzo2o.foundations.service.IServeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController("consumerHomeController")
@RequestMapping("/customer/serve")
@Api("首页(门户)管理")
public class HomeController {

    @Resource
    private IServeService serveService;

    @GetMapping("/firstPageServeList")
    @ApiOperation("查询首页服务类型列表接口")
    public List<ServeCategoryResDTO> firstPageServeList(@RequestParam("regionId") @ApiParam(name = "regionId", value = "regionId")
                                                   Long regionId) {
        return serveService.firstPageServeList(regionId);
    }

    @GetMapping("/serveTypeList")
    @ApiOperation("查询服务类型列表接口")
    public List<ServeType> serveTypeList(@RequestParam("regionId") @ApiParam(name = "regionId", value = "regionId")
                                                   Long regionId) {
        return serveService.selectServeTypeList(regionId);
    }

    @GetMapping("/hotServeList")
    @ApiOperation("查询首页热门服务接口")
    public List<ServeAggregationSimpleResDTO> hotServeList(
            @RequestParam("regionId") @ApiParam(name = "regionId", value = "区域id") Long regionId
    ) {
        return serveService.hotServeList(regionId);
    }

    @GetMapping("{id}")
    @ApiOperation("查询服务详情信息接口")
    public ServeAggregationSimpleResDTO serveParticularsInfo(
            @PathVariable("id") @ApiParam(name = "id", value = "服务id")
            Long id
    ) {
        return serveService.serveParticularsInfo(id);
    }
}
